package hw3.proxy.gui;

import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.FlowLayout;
import java.awt.Font;

import javax.swing.GroupLayout;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.LayoutStyle;
import javax.swing.border.BevelBorder;
import javax.swing.border.TitledBorder;

public class QueryResultFrame extends JDialog
{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	public JTable resultTable;
	public JTextField queryField;
	/**
	 * Launch the application
	 * @param args
	 */
	public static void main(String args[])
	{
		EventQueue.invokeLater(new Runnable()
		{
			public void run()
			{
				try
				{
					QueryResultFrame frame = new QueryResultFrame();
					frame.setVisible(true);
				} catch (Exception e)
				{
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame
	 */
	public QueryResultFrame()
	{
		super();
		setTitle("Query Result");
		setBounds(100, 100, 500, 375);
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

		final JPanel panel = new JPanel();
		getContentPane().add(panel, BorderLayout.CENTER);

		JLabel queryLabel;

		queryField = new JTextField();
		queryField.setBorder(new BevelBorder(BevelBorder.LOWERED));
		queryField.setEditable(false);

		JPanel panel_1;
		panel_1 = new JPanel();
		panel_1.setLayout(new FlowLayout());
		panel_1.setBorder(new TitledBorder(null, "Query", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null));
		queryLabel = new JLabel();
		queryLabel.setFont(new Font("", Font.BOLD, 12));
		queryLabel.setText("Query:");
		panel_1.add(queryLabel);
		panel_1.add(queryField);

		JScrollPane scrollPane;
		scrollPane = new JScrollPane();
		scrollPane.setBorder(new TitledBorder(null, "Result", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null));

		resultTable = new JTable();
		scrollPane.setViewportView(resultTable);
		final GroupLayout groupLayout = new GroupLayout((JComponent) panel);
		groupLayout.setHorizontalGroup(
			groupLayout.createParallelGroup(GroupLayout.Alignment.TRAILING)
				.addGroup(groupLayout.createSequentialGroup()
					.addContainerGap()
					.addGroup(groupLayout.createParallelGroup(GroupLayout.Alignment.TRAILING)
						.addComponent(scrollPane, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 468, Short.MAX_VALUE)
						.addComponent(panel_1, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 468, Short.MAX_VALUE))
					.addContainerGap())
		);
		groupLayout.setVerticalGroup(
			groupLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
				.addGroup(groupLayout.createSequentialGroup()
					.addContainerGap()
					.addComponent(panel_1, GroupLayout.PREFERRED_SIZE, 74, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
					.addComponent(scrollPane, GroupLayout.DEFAULT_SIZE, 237, Short.MAX_VALUE)
					.addContainerGap())
		);
		panel.setLayout(groupLayout);
		//
	}

}
